package cn.edu.ctbu.datajpa01.aspect;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.annotation.*;
import org.springframework.stereotype.Component;

@Aspect
@Component
@Slf4j
public class HttpAspect {

    @Pointcut("execution(public * cn.edu.ctbu.datajpa01.restcontroller.StudentRestController.*(..))")
    public void log() {

    }
    @Before("log()")
    public void doBefore() {System.out.print("1111");}
    @After("log()")
    public void doAfter() {System.out.print("2222");}

    @AfterReturning(returning = "object",pointcut = "log()")
    public void doAfterReturning(Object object) {
        log.info("response={}",object);
    }
}
